package org.example.config.mqtt.property;

import lombok.Data;
import org.example.enums.MqttChannelTypeEnum;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

@Data
public class MqttTopicProperty {

    /**
     * 适配器名称
     */
    @NotBlank
    private String channelAdapterName;

    /**
     * 客户端id
     */
    @NotBlank
    private String clientId;

    /**
     * 输出通道名称
     */
    @NotNull
    private MqttChannelTypeEnum outPutChannelType;

    @NotBlank
    private String outPutChannelName;

    /**
     * 手动确认
     */
    private boolean manualAcks;
    /**
     * 确认超时时间
     */
    private Integer completionTimeout;
    /**
     * topic配置
     */
    @Valid
    @NotEmpty
    private List<Topic> topics;
    /**
     * 集成流名称
     */
    @NotBlank
    private String integrationFlowName;

    @Data
    public static class Topic {
        /**
         * 主题
         */
        @NotBlank
        private String topic;
        /**
         * qos
         */
        private Integer qos;
    }
}
